﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JV.Com.Model
{
    public enum ArticleType
    {
        Folder,
        Test,
        Preview
    }

    public abstract class Article
    {
        public int Id { get; set; }
        public string Title { get; set; }
        public ArticleType Type { get; set; }
        public string Author { get; set; }
        public string Content { get; set; }
        public string SmallImageUrl { get; set; }
        public string ImageTopUrl { get; set; }
        public string Url { get; set; }
        public string GlobalReview { get; set; }
        public DateTime Date { get; set; }
        public List<int> Machines { get; set; }

        public static Article Create(string type)
        {
            Article article;
            switch (type)
            {
                case "test": article = new Test(); article.Type = ArticleType.Test; return article;
                case "dossier": article = new Folder(); article.Type = ArticleType.Folder; return article;
                case "preview": article = new Preview(); article.Type = ArticleType.Preview; return article;
                default: throw new NotImplementedException();
            }
        }
        public static Article Create(ArticleType type)
        {
            Article article;
            switch (type)
            {
                case ArticleType.Test: article = new Test(); article.Type = ArticleType.Test; return article;
                case ArticleType.Folder: article = new Folder(); article.Type = ArticleType.Folder; return article;
                case ArticleType.Preview: article = new Preview(); article.Type = ArticleType.Preview; return article;
                default: throw new NotImplementedException();
            }
        }
    }
}
